package com.hd.boot.service.impl;

import com.hd.boot.dao.TeacherDao;
import com.hd.boot.pojo.Teacher;
import com.hd.boot.service.TeacherService;
import com.hd.boot.util.JsonData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collection;

@Service
public class TeacherServiceImpl implements TeacherService {
    @Autowired
    private TeacherDao teacherDao;


    @Override
    public JsonData allTea() {
        Collection<Teacher> teachers=teacherDao.allTea();
        return JsonData.buildSuccess(teachers,"success");
    }

    @Override
    public JsonData delTea(int teaId) {
        teacherDao.delTea(teaId);
        return JsonData.buildSuccess("删除成功");
    }

    @Override
    public JsonData saveTea(Teacher teacher) {
        teacherDao.saveTea(teacher);
        return JsonData.buildSuccess("添加成功");
    }
}
